<?php
class PNOrderArray extends PNObjectArray {
  function PNOrderArray($init=null, $where='')
  {
    $this->PNObject();

    $this->_objType       = 'ishopstore_order';
    $this->_objField      = 'id';
    $this->_objPath       = 'form';

    $this->_init($init, $where);
  }
  
  function selectExtendResult()
  {
    foreach($this->_objData as $item){
      if ($item[id]){
        $result[$item[id]]['itemList'] = DBUtil::selectObjectArray('ishopstore_order_item', "WHERE orditm_order_id = '$item[id]'");
        $result[$item[id]]['itemListCount'] = count($result[$item[id]]['itemList']);
        $result[$item[id]]['totalQuantity'] = 0;
        foreach($result[$item[id]]['itemList'] AS $itemList){
          $result[$item[id]]['totalQuantity'] += $itemList['quantity'];
        }
      }
    }
    return $result;
  }
}
